﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SWCInvoice.Enums;
using SWCInvoice.Model;

namespace SWCInvoice.Returntyps {

    /// <summary>
    /// Result of the CreatePDF method
    /// </summary>
    public class CreatePDFInfo :BaseInfo {

        #region Constanten

        /// Base object resource typ
        private const string RESOURCE_STRING = "CreatePDF";

        #endregion

        #region Fields

        /// <summary>
        /// Foldername of the results
        /// </summary>
        private string _folderName;
        /// <summary>
        /// Name of the VDS
        /// </summary>
        private string _vdsName;
        /// <summary>
        /// The document count
        /// </summary>
        private int _documentCount;
        /// <summary>
        /// The page count
        /// </summary>
        private int _pageCount;

        #endregion

        #region Properties

        /// <summary>
        /// Base object resource typ
        /// </summary>        
        public override string ResourceString {
            get { return RESOURCE_STRING; }
        }

        /// <summary>
        /// Foldername of the results
        /// </summary>        
        public string FolderName {
            get { return _folderName; }
            set { _folderName = value; }
        }

        /// <summary>
        /// Name of the VDS
        /// </summary>
        public string VdsName {
            get { return _vdsName; }
            set { _vdsName = value;}
        }

        /// <summary>
        /// The document count
        /// </summary>
        public int DocumentCount {
            get { return _documentCount; }
            set { _documentCount = value; }
        }

        /// <summary>
        /// The page count
        /// </summary>
        public int PageCount {
            get { return _pageCount; }
            set { _pageCount = value; }
        }
        
        #endregion

        #region Methods

        public override MessageTyp SetMessageTypByObjectContent() {
            if (ExceptionList == null || ExceptionList.Count == 0) {
                MessageTyp = MessageTyp.Information;
            }
            return MessageTyp;
        }

        public override Message EnrichMessageWithParameters(Message message) {
            if (MessageTyp == MessageTyp.Information)
                message.Description = string.Format(message.Description, FolderName, VdsName, DocumentCount, PageCount);
            
            
            if (MessageTyp == MessageTyp.Error)
                message.Description = string.Format(message.Description, ExceptionList[0].Message);
            

            return message;
        }

        #endregion
    }
}
